<?php

include('app_setting.php');
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
    'name' => $_CONFIG['app']['name'],
    'theme' => $_CONFIG['theme']['frontend']['name'],
    // preloading 'log' component
    'preload' => array('log'),
    // autoloading model and component classes
    'import' => array(
        'application.models.active_record.*',
        'application.models.form.*',
        'application.components.*',
        'application.helpers.*',
    ),
    'modules' => array(
        // uncomment the following to enable the Gii tool
        'admin' => array(
            'modules' => array(
                'configuration',
                'home',
                'content',
                'system',
                'report',
            )
        ),
        'member' => array(
        ),
        'gii' => array(
            'class' => 'system.gii.GiiModule',
            'password' => 'admin',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters' => array('127.0.0.1', '::1'),
        ),
    ),
    //'homeUrl'=>array('admin/login'),
    // application components
    'components' => array(
        'user' => array(
            // enable cookie-based authentication
            'allowAutoLogin' => true,
        ),
        // uncomment the following to enable URLs in path-format
        'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => false,
            'caseSensitive' => false,
            'rules' => array(
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>/<title>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
                '<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
                '<module1:\w+>/<module2:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<module1>/<module2>/<controller>/<action>',
                '<module1:\w+>/<module2:\w+>/<controller:\w+>/<action:\w+>' => '<module1>/<module2>/<controller>/<action>',
                '<controller:\w+>/<action:\w+>/<value>' => '<controller>/<action>',
                // REST patterns
                array('service/list', 'pattern'=>'service/<model:\w+>', 'verb'=>'GET'),
                array('service/view', 'pattern'=>'service/<model:\w+>/<id:\d+>', 'verb'=>'GET'),

            ),
        ),
        'db' => array(
            'connectionString' => 'mysql:host=' . $_CONFIG['db']['host'] . ';dbname=' . $_CONFIG['db']['name'],
            'emulatePrepare' => true,
            'username' => $_CONFIG['db']['username'],
            'password' => $_CONFIG['db']['password'],
            'charset' => 'utf8',
            'enableProfiling'=>false,
        ),
        'errorHandler' => array(
            // use 'site/error' action to display errors
            'errorAction' => 'site/error',
        ),
        
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CWebLogRoute',
                    //'categories' => 'system.*',
                    'categories' => 'system.db.CDbCommand',
                ),
                array(
                    'class' => 'CProfileLogRoute',
                    'report' => 'summary',
                    'showInFireBug'=>false,
                ),
            ),
        ),
        
    ),
    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params' => array(
        //bonus
        'bonus' => include_once 'bonus.php',
        'bonus_board' => include_once 'bonus_board.php',
        //configuration
        'config' => $_CONFIG,
        // this is used in contact page
        'adminEmail' => $_CONFIG['app']['email'],
        //theme path
        'backendUrl' => $_CONFIG['theme']['backend']['url'],
        'backendPath' => $_CONFIG['theme']['backend']['path'],
        'frontendUrl' => $_CONFIG['theme']['frontend']['url'],
        'frontendPath' => $_CONFIG['theme']['frontend']['path'],
        'memberUrl' => $_CONFIG['theme']['member']['url'],
        'memberPath' => $_CONFIG['theme']['member']['path'],
        //pagination
        'newsPerPage' => $_CONFIG['pagination']['news'],
        'productsPerPage' => $_CONFIG['pagination']['products'],
        'testimonyPerPage' => $_CONFIG['pagination']['testimony'],
        'stockistPerPage' => $_CONFIG['pagination']['stockist'],
    ),
);
